<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: Lai
  Date: 2021/10/2/0002
  Time: 17:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>循环</title>
</head>
<body>
    <%--向域对象中添加集合--%>
    <%
        ArrayList<String>list=new ArrayList<>();
        list.add("aaa");
        list.add("bbb");
        list.add("ccc");
        list.add("ddd");
        pageContext.setAttribute("list",list);
    %>
    <%--遍历集合--%>
    <c:forEach items="${list}" var="str">
        ${str}<br>
    </c:forEach>
</body>
</html>
